import { MockMethod } from "vite-plugin-mock"

export default [
  {
    url: "/dev-api/goods/category/search",
    timeout: 2000,
    method: "post",
    response: () => {
      return {
        "code": 20000,
        "message": "查询成功",
        "data": {
          "total": "@integer(100, 200)", // 总记录数
          "records|20": [{ //生成20条数据
            "id|+1": 1, //初始值1开始，每条+1
            "name": "@first",
            "sort|+1": 1,
            'status|10-2': true, // Boolean, 生成 true 概率 10/(10+2), false 概率 2/(10+2)
            "remarks": "@ctitle"
          }]
        }
      }
    }
  },
  {
    url: "/dev-api/goods/category/list",
    timeout: 2000,
    method: "get",
    response: () => {
      return {
        "code": 20000,
        "message": "查询成功",
        "data|10": [{
          "categoryId|+1": 10, // 初始值10开始，每条+1
          "categoryName": '@first'
        }]
      }
    }
  },
  {
    url: "/dev-api/goods/category/:id",
    timeout: 2000,
    method: "delete",
    response: () => {
      return {
        "code": 20000,
        "message": "删除成功",
        "data": true
      }
    }
  },
  {
    url: "/dev-api/goods/category",
    timeout: 2000,
    method: "post",
    response: () => {
      return {
        "code": 20000,
        "message": "新增成功",
        "data": true
      }
    }
  },
  {
    url: "/dev-api/goods/category",
    timeout: 2000,
    method: "put",
    response: () => {
      return {
        "code": 20000,
        "message": "更新成功",
        "data": true
      }
    }
  },
] as MockMethod[]